import request from './request'

/**
 * 健康检查API
 */
export const healthCheckApi = {
  /**
   * 检查DeepSeek AI服务健康状态
   */
  checkDeepSeekHealth() {
    return request({
      url: '/api/health-check/deepseek',
      method: 'get',
      timeout: 5000 // 5秒超时
    })
  },

  /**
   * 检查API密钥配置状态
   */
  checkApiKeyStatus() {
    return request({
      url: '/api/health-check/api-key',
      method: 'get',
      timeout: 3000 // 3秒超时
    })
  },

  /**
   * 检查系统整体健康状态
   */
  checkSystemHealth() {
    return request({
      url: '/api/health-check/system',
      method: 'get',
      timeout: 10000 // 10秒超时
    })
  },

  /**
   * 快速健康检查
   */
  quickHealthCheck() {
    return request({
      url: '/api/health-check/quick',
      method: 'get',
      timeout: 3000 // 3秒超时
    })
  },

  /**
   * 获取健康检查历史记录
   * @param {number} limit - 记录数量限制
   */
  getHealthCheckHistory(limit = 10) {
    return request({
      url: '/api/health-check/history',
      method: 'get',
      params: { limit },
      timeout: 5000
    })
  },

  /**
   * 测试AI聊天功能
   * @param {string} testMessage - 测试消息
   */
  testAiChat(testMessage = '健康检查测试消息') {
    return request({
      url: '/api/xiaozhi/chat',
      method: 'post',
      data: {
        memoryId: Date.now(),
        message: testMessage
      },
      timeout: 15000 // 15秒超时，AI响应可能较慢
    })
  }
}

export default healthCheckApi